package com.pangzhao.prize.commons.db.mapper;

import com.pangzhao.prize.commons.db.entity.CardProduct;
import com.pangzhao.prize.commons.db.entity.CardProductExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface CardProductMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    long countByExample(CardProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    int deleteByExample(CardProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    @Delete({
        "delete from card_product",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    @Insert({
        "insert into card_product (name, pic, ",
        "info, price)",
        "values (#{name,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR}, ",
        "#{info,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(CardProduct record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    int insertSelective(CardProduct record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    List<CardProduct> selectByExample(CardProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, name, pic, info, price",
        "from card_product",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.pangzhao.prize.commons.db.mapper.CardProductMapper.BaseResultMap")
    CardProduct selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") CardProduct record, @Param("example") CardProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") CardProduct record, @Param("example") CardProductExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(CardProduct record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table card_product
     *
     * @mbg.generated
     */
    @Update({
        "update card_product",
        "set name = #{name,jdbcType=VARCHAR},",
          "pic = #{pic,jdbcType=VARCHAR},",
          "info = #{info,jdbcType=VARCHAR},",
          "price = #{price,jdbcType=DECIMAL}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CardProduct record);
}